An interface is a concept independent of the language. However,some languages like Java have interface as a language keyword which implement this general concept of interface. An interface is a contract which an object promises to honor."How" the contract is honored is up to the object but what it assures is the "what" part of the contract. We can also say that an interface is the facade which the object puts up for the outside world to interrogate and interact.
An interface is a set of methods or that's behavior and which the clients interact with the given class implementing the interface through intteractive class .
Syntax for declaring the Interface :
<interface name> { return type method name1(Par1);
return type method name2(Par2);
Final constant value N;
}
Example :
interface readable{
void read();
}
class software implements readable{
public void read()
{System.out.println("Mindstick");}
public static void main(String args[]){
software obj = new software();
obj.read();
}
}
output : Mindstick.
Happy Coding :)
Liked By
Write Answer
Interface ?
Join MindStick Community
You have need login or register for voting of answers or question.
Prakash nidhi Verma
15-Jun-2018Interface :
An interface is a concept independent of the language. However,some languages like Java have interface as a language keyword which implement this general concept of interface. An interface is a contract which an object promises to honor."How" the contract is honored is up to the object but what it assures is the "what" part of the contract. We can also say that an interface is the facade which the object puts up for the outside world to interrogate and interact.
An interface is a set of methods or that's behavior and which the clients interact with the given class implementing the interface through intteractive class .
Syntax for declaring the Interface :
Example :
output : Mindstick.
Happy Coding :)